<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 	   <meta name="renderer" content="webkit">
		<title>祥利百悦</title>
		<link rel="stylesheet" href="../../css/bootstrap.min.css" />
		<link rel="stylesheet" href="../../css/common.css" />
		<link rel="stylesheet" href="../../css/welcome.css" />
		<link rel="stylesheet" href="../../css/jquery.ptTimeSelect.css" /><!-- 日历样式 -->
		<link rel="stylesheet" href="../../css/validationEngine.jquery.css" /><!--表单验证css-->
		<script type="text/javascript" src="../../js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="../../js/jquery.validationEngine-zh_CN.js" ></script>
		<script type="text/javascript" src="../../js/jquery.validationEngine.js" ></script>
		<script type="text/javascript" src="../../js/common.js"></script>
		<script type="text/javascript" src="../../js/jquery.ptTimeSelect.js" ></script><!--日历插件-->
		<script type="text/javascript" src="../../js/jquery.placeholder.js"  charset="utf-8"></script><!-- placehoder兼容 -->
	</head>

	<body>
		<div class="main_content create_site">
			<div class="col-xs-12 col-sm-12 div_bordered">
				<div class="panel panel-default choose_block">
					<div class="fixed_top panel panel-default choose_block">
						<div class="panel-heading color333 ">长者信息
							<a class="btn btn_blueg2 pull-right" href="${ctx}/member/get_member_list" style="margin-right: 10px;">&lt;返回列表</a>
						</div>
					</div>
					<div class="panel-heading color333">长者信息
						<a href="javascript:history.go(-1);" class="colorbg font14 pull-right mr15">&lt;&lt;返回列表</a>
					</div>
					<div class="divider"> 
						<input type="hidden" id="member_id" value="${memberBase.memberId}">
						<input type="hidden" id="server_station_code" value="${memberBase.serverStationCode}">
						<c:set var="member_page_flag" scope="session" value="0"></c:set>
					</div>
					<div class="site_block member_block">
						<div class="well_head">
							<div class="line"></div>
							<span class="pull-left">基础信息</span>
								<button type="button" class="btn  btn-sm btn_edit pull-right" id="see_member_base"></button>
						</div>
						<div id="member_base_jsp">
							<div class="panel-body relative">
								<form class="form-horizontal form_txt" role="form">
									<div class="form-group tx-block" style="position: absolute;top: 15px;left: 650px;">
										<div class="pull-left">
											<img src="../../img/touxiang.jpg" width="200px" height="254px" />
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">姓名：</label>
										<div class="col-sm-10 txt">
											<p>${memberBase.name}</p>
										</div>
									</div>
									<div class="form-group">
										<label for="lastname" class="col-sm-2 control-label">性别：</label>
										<div class="col-sm-10 txt">
											${memberBase.sex==1?"男":"女"}
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">证件类型：</label>
										<div class="col-sm-10 txt">
											身份证
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">证件号码：</label>
										<div class="col-sm-10 txt">
											${memberBase.postionNumber}
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">出生日期：</label>
										<div class="col-sm-10 txt">
											<fmt:formatDate value="${memberBase.birthday}" type="date"/>
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">手机号码：</label>
										<div class="col-sm-10 txt">
											${memberBase.phone}
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">家庭座机：</label>
										<div class="col-sm-10 txt">
											${memberBase.telphone}
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">居住地址：</label>
										<div class="col-sm-10 txt">
											<div id="jsAddress_0"  class="selectbox_l selectbox_show">
												<input type="hidden" name="province" class="province" value="${memberBase.resideProvince}"/>
												<input type="hidden" name="city" class="city" value="${memberBase.resideCity}"/>
												<input type="hidden" name="area" class="area" value="${memberBase.resideArea}"/>
												<div name="province" type="selectbox"  class="btn-group inline "></div>
												<div name="city" type="selectbox"  class="btn-group inline"></div>
												<div name="area" type="selectbox"  class="btn-group inline"></div>
											</div>
											<div class=" inline">
												${memberBase.resideAddress}
											</div>
										</div>
									</div>
								</form>
							</div>

						</div>
		
		
						<div class="well_head">
							<div class="line"></div>
							<span class="pull-left">长者相关</span>
								<button type="button" class="btn  btn-sm btn_edit pull-right" id="see_member_relation"></button>
						</div>
						<div id="member_relation_jsp">
							<div class="panel-body">
								<form class="form-horizontal form_txt" role="form">
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">相关亲属：</label>
										<div class="col-sm-10 txt">
											<c:forEach  items="${memberEmergencyContactList}" var="emergency">
												<div class="inline">${emergency.emergencyContactName}</div>
												<div class="inline">
													${emergency.emergencyContactRel}
												</div>
												<div class="inline">${emergency.emergencyContactPhone}</div>
												<div class="inline">紧急联系人</div>
												<br/>
											</c:forEach>
										</div>
									</div>
								</form>
							</div>
						</div>
						<div class="well_head">
							<div class="line"></div>
							<span class="pull-left">其他信息</span>
								<button type="button" class="btn  btn-sm btn_edit pull-right " id="edit_member_other"></button>
						</div>
						<div id="member_other_jsp">
							<div class="panel-body  other">
								<form class="form-horizontal form_txt" role="form">
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">住院号：</label>
										<div class="col-sm-10 txt">
											<div class="inline">${memberInfo.liveNo}</div>
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">责任医师：</label>
										<div class="col-sm-10 txt">
											<div class="inline">${memberHealthystateRel.physician}</div>
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">护理等级：</label>
										<div class="col-sm-10 txt">
											<div class="inline">${memberHealthystateRel.level}</div>
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">病情：</label>
										<div class="col-sm-10 txt">
											<div class="inline">${memberHealthystateRel.illness}</div>
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">注意事项：</label>
										<div class="col-sm-10 txt">
											<div class="inline">${memberHealthystateRel.notice}</div>
										</div>
									</div>
									
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">兴趣爱好：</label>
										<div class="col-sm-10 txt">
												<div class="inline">${memberHealthystateRel.hoddy}</div>
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">饮食禁忌：</label>
										<div class="col-sm-10 txt">
												<div class="inline">${memberHealthystateRel.foodType}</div>
										</div>
									</div>
									<div class="form-group">
										<label for="firstname" class="col-sm-2 control-label">民族：</label>
										<div class="col-sm-10 txt">
											<div class="inline">
												${memberInfo.nation}
											</div>
										</div>
									</div>
									<div class="form-group">
										<label for="firstname" class="col-sm-2 control-label">血型：</label>
										<div class="col-sm-10 txt">
											<div class="inline">
												${memberInfo.bloodType}
											</div>
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">职业：</label>
										<div class="col-sm-10 txt">
											<div class="inline">
												${memberInfo.profession}
											</div>
										</div>
									</div>
									<div class="form-group">
										<label for="firstname" class="col-sm-2 control-label">文化程度：</label>
										<div class="col-sm-10 txt">
											<div class="inline">
												${memberInfo.cultureDegree}
											</div>
										</div>
									</div>
									
									<div class="form-group">
										<label for="firstname" class="col-sm-2 control-label">婚姻状况：</label>
										<div class="col-sm-10 txt">
											<div class="inline">
												${memberInfo.maritalStatus}
											</div>
										</div>
									</div>
									<div class="form-group">
										<label for="firstname" class="col-sm-2 control-label">经济来源：</label>
										<div class="col-sm-10 txt">
											<div class="inline">
												${memberInfo.pocketBook}
											</div>
										</div>
									</div>
									<div class="form-group">
										<label for="firstname" class="col-sm-2 control-label">健康状况：</label>
										<div class="col-sm-10 txt">
											${memberHealthystateRel.healthType}
										</div>
									</div>
									<div class="form-group">
										<label for="firstname" class="col-sm-2 control-label">身体状况：</label>
										<div class="col-sm-10 txt">
											${memberHealthystateRel.bodyType}
										</div>
									</div>
									<div class="form-group">
										<label for="" class="col-sm-2 control-label">备注：</label>
										<div class="col-sm-10 txt">
											${memberInfo.remark}
										</div>
									</div>
								</form>
								<div id="huji_address_info" style="display: none"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
	//修改长者信息界面最底部保存按钮事件
	var big_save_flag2 = 1;
	var big_save_flag4 = 1;
	var big_save_flag6 = 1;

	function big_save () {
		var $text7 = $("#member_base").text();
		if($text7 == "保存"){
			update_member_base(1);
		}
		var $text8 = $("#member_relation").text();
		if($text8 == "保存" && big_save_flag2 == 1){
			updateMemberRelation(1);
		}
		var $text9 = $("#other_info").text();
		if($text9 == "保存" && big_save_flag2 == 1 && big_save_flag4 == 1){
			update_member_info(1);
		}
		if(big_save_flag2 == 0){
			var offset= $("[id='member_base']").offset();
			$(window).scrollTop(offset.top);
			return false;
		}
		if(big_save_flag4 == 0){
			get_update_member_base();
			var offset= $("[id='member_relation']").offset();
			$(window).scrollTop(offset.top);
			return false;
		}
		if(big_save_flag6 == 0){
			get_update_member_base();
			getUpdMemberRelation(0);
			var offset= $("[id='other_info']").offset();
			$(window).scrollTop(offset.top);
			return false;
		}
		
		window.location = "${ctx}/member/get_member_list";
	};
	//大取消
	function big_cancel () {
		window.location = "${ctx}/member/get_member_list";
	};

	//查看页面长者===长者相关===点击调用
	$("#see_member_relation").click(function(){
		var $text6 = $(this).text();
		if($text6 == "保存"){
			updateMemberRelation(0);
		}
		if($text6 == "编辑"){
			getUpdMemberRelation();
		}
	});

	//修改页面长者===长者相关===紧急联系人===id拼接
	function emergency_ids(){
		$("#emergency_ids").val("");
		var emergencyIds = "";
		$(":input[name='emergency_id']").each(function(){
			if($(this).val() != null && $(this).val() != "" && $(this).val() != undefined){
				emergencyIds += $(this).val()+"_";
			}
		});
		$("#emergency_ids").val(emergencyIds);
	}

	//修改页面长者===长者相关===紧急联系人===姓名拼接
	function emergency_names(){
		$("#emergency_names").val("");
		var emergencyNames = "";
		$(":input[name='emergency_name']").each(function(){
			if($(this).val() != null && $(this).val() != "" && $(this).val() != undefined){
				emergencyNames += $(this).val()+"_";
			}
		});
		$("#emergency_names").val(emergencyNames);
	}

	//修改页面长者===长者相关===紧急联系人===关系拼接
	function emergency_rels(){
		$("#emergency_rels").val("");
		var emergencyRels = "";
		$(":button[name='emergency_rel']").each(function(){
			if($(this).attr("value") != null 
					&& $(this).attr("value") != "" 
					&& $(this).attr("value") != undefined
					&& $(this).attr("value") != "0"){
				emergencyRels += $(this).attr("value")+"_";
			}
		});
		$("#emergency_rels").val(emergencyRels);
	}

	//修改页面长者===长者相关===紧急联系人===联系电话拼接
	function emergency_phones(){
		$("#emergency_phones").val("");
		var emergencyPhones = "";
		$(":input[name='emergency_phone']").each(function(){
			if($(this).val() != null && $(this).val() != "" && $(this).val() != undefined){
				emergencyPhones += $(this).val()+"_";
			}
		});
		$("#emergency_phones").val(emergencyPhones);
	}

	//修改页面长者===长者相关===紧急联系人===是否紧急联系人
	function emergency_types(){
		$("#emergency_types").val("");
		var emergencyTypes = "";
		$(":input[name='emergency_type']").each(function(){
			if($(this).attr("value") != null 
					&& $(this).attr("value") != "" 
					&& $(this).attr("value") != undefined
					&& $(this).attr("value") != "0"){
				emergencyTypes += $(this).val()+"_";
			}
		});
		$("#emergency_types").val(emergencyTypes);
	}

	//验证
	function validateEmergency(){
		var nameErrorCount = 0, nameRegexError = 0;
		$("input[name=emergency_name]").each(function(){
			var name = $.trim($(this).val());
			if(name == null || name == "" || name.length == 0){
				$(this).css("border","1px solid red");
				nameErrorCount++;
			}
			
			if(!(/^[\u4E00-\u9FA5A-Za-z0-9]{2,8}$/g).test(name)){
				$(this).css("border","1px solid red");
				nameRegexError++;
			}
		});
		
		if(nameErrorCount > 0){
			zhyAlert("请填写亲属姓名");
			return false;
		}
		
		if(nameRegexError > 0){
			zhyAlert("请填写正确的亲属姓名");
			return false;
		}
		
		var relErrorCount = 0;
		$("button[name=emergency_rel]").each(function(){
			var rel = $.trim($(this).attr("value"));
			if(rel == null || rel == "" || rel.length == 0 || rel == "0"){
				$(this).parent().css("border","1px solid red");
				relErrorCount ++;
			}
		});
		
		if(relErrorCount > 0){
			zhyAlert("请选择关系");
			return false;
		}
		
		var phoneErrorCount = 0, phoneRegexError = 0;
		$("input[name=emergency_phone]").each(function(){
			var phone = $.trim($(this).val());
			if(phone == null || phone == "" || phone.length == 0){
				$(this).css("border","1px solid red");
				phoneErrorCount++;
			}
			
			var regex = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/g;
			if(!regex.test(phone)){
				$(this).css("border","1px solid red");
				phoneRegexError++;
			}
		});
		
		if(phoneErrorCount > 0){
			zhyAlert("请填写手机号码");
			return false;
		}
		
		if(phoneRegexError > 0){
			zhyAlert("请正确填写手机号码");
			return false;
		}
		
		var typeErrorCount = 0, contactCount = 0;
		$("button[name=emergency_type]").each(function(){
			if($(this).val() == null || $(this).val() == "" || $(this).val().length == 0 || $(this).val() == "0"){
				$(this).parent().css("border","1px solid red");
				typeErrorCount ++;
			}else if($(this).val() == "2"){
				contactCount++;
			}
		});
		
		if(typeErrorCount > 0){
			zhyAlert("请选择是否为紧急联系人");
			return false;
		}
		
		if(contactCount > 5){
			zhyAlert("最多只能添加5位紧急联系人");
			$("button[name=emergency_type][value=2]:gt(4)").parent().css("border","1px solid red");
			return false;
		}
		
		return true;
	}

	function updateMemberRelation(flag){
		emergency_ids();
		emergency_names();
		emergency_rels();
		emergency_phones();
		emergency_types();
		
		if($("#emergency_names").val() === "" 
				&& $("#emergency_rels").val() === "" 
				&& $("#emergency_phones").val() === "" 
				&& $("#emergency_types").val() === "" ){
			return false;
		}
		
		if($("#emergency_names").val() != "" && $("#emergency_names").val() != null){
			var eme1 = $("#emergency_names").val().split("_");
			var eme2 = $("#emergency_rels").val().split("_");
			var eme3 = $("#emergency_phones").val().split("_");
			var eme4 = $("#emergency_types").val().split("_");
			if(eme1.length != eme2.length 
					|| eme2.length != eme3.length 
					|| eme3.length != eme4.length){
				big_save_flag4 = 0;
				zhyAlert("请填写完整紧急联系人信息！");
				return false;
			}
		}
		
		if(!validateEmergency()){
			big_save_flag4 = 0;
			return false;
		}
		
		var delIds = delIdArray.join(",");
		$.ajax({
			type : "POST",
			dataType: "json",
			url : "${ctx}/member/update_member_relation",
			async: false,
			data:{
				memberId: $("#member_id").val(),
				serverStationCode: $("#server_station_code").val(),
				emergencyIds: $("#emergency_ids").val(),
				emergencyNames: $("#emergency_names").val(),
				emergencyRels: $("#emergency_rels").val(),
				emergencyPhones: $("#emergency_phones").val(),
				emergencyTypes: $("#emergency_types").val(),
				delId: delIds
			},
			success: function(data) {
				if(data.resultCode === "SUCC" && data.data){
					big_save_flag4 = 1;
					if(flag == 0){
						getSeeMemberRelation();
					}
				}else{
					big_save_flag4 = 0;
					zhyAlert("保存失败");
				}
			}
		});
	}

	//获得长者===长者相关==查看页面
	function getSeeMemberRelation(flag){
		$.ajax({
			type : "post",
			dataType: "html",
			url : "${ctx}/member/get_see_member_relation",
			async: true,
			data:{
				memberId:$("#member_id").val()
			},
			success : function(data) {
				$("#member_relation_jsp").empty().html(data);
				$("#see_member_relation").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
			}
		});
	}

	//获得长者===长者相关==修改/编辑页面
	function getUpdMemberRelation(flag){
		$.ajax({
			type : "post",
			dataType: "html",
			url : "${ctx}/member/get_update_member_relation",
			async: true,
			data:{
				memberId:$("#member_id").val()
			},
			success : function(data) {
				$("#member_relation_jsp").empty().html(data);
				$("#see_member_relation").removeAttr("class").attr("class","btn  btn-sm btn-save pull-right").empty().text("保存");
			}
		});
	}

	//查看详情页面长者基础信息点击调用
	$("#see_member_base").click(function(){
		var $text4 = $(this).text();
		if($text4 == "保存"){
			update_member_base(0)
		}
		if($text4 == "编辑"){
			get_update_member_base();
		}
	});
	//修改长者基本信息===flag为0时，会的查看页面，为1时不获得查看页面
	function update_member_base(flag){
		if($("input[name='province']").val() == -1){
			big_save_flag2 = 0;
			zhyAlert("请选择居住省");
			return false;
		}
		
		if($("input[name='city']").val() == -1){
			big_save_flag2 = 0;
			zhyAlert("请选择居住市");
			return false;
		}
		
		if(!$("#member_base_from").validationEngine("validate")){
			big_save_flag2 = 0;
			return false;
		} 
		
		if($("#juzhu_address1").val().length >= 32){
			big_save_flag2 = 0;
			zhyAlert("详细地址长度应小于32");
			return false;
		}
		
		$.ajax({
			type : "post",
			dataType: "json",
			url : "${ctx}/member/update_member_base",
			async: false,
			data:{
				serverStationCode: $("#server_station_code").val(),
				memberId: $("#member_id").val(),
				name: $("#name1").val(),
				avatar: $("#avatar_url").attr("src"),
				IDType: $("#idType .dropdown-text").attr("value"),
				postionNumber: $("#id_card1").val(),
				sex: $("input[type=radio]:checked").attr("value"),
				birthdayStr: $("#birthday1").val(),
				phone: $("#phone1").val(),
				telphone: $("#telphone").val(),
				resideProvince: $("#member_base_from").find(":input[name='province']").val(),
				resideCity: $("#member_base_from").find(":input[name='city']").val(),
				resideArea: $("#member_base_from").find(":input[name='area']").val(),
				resideAddress: $("#juzhu_address1").val(),
				memberLevel: $("#memberLevel").attr("value")
			},
			success : function(data) {
				if(data.resultCode === "SUCC" && data.data){
					if(flag==0){
						get_see_member_base();
					}
				}else{
					big_save_flag2 = 0;
					zhyAlert(data.failureMessage);
				}
			}
		});
	}

	//获得长者基础信息===查看===页面
	function get_see_member_base(){
		$.ajax({
			type: "post",
			dataType: "html",
			url: "${ctx}/member/get_see_member_base",
			async: true,
			data:{
				memberId:$("#member_id").val()
			},
			success : function(data) {
				$("#member_base_jsp").empty().html(data);
				$("#see_member_base").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
			}
		});
	}

	//获得长者基础信息===修改===页面
	function get_update_member_base(){
		$.ajax({
			type: "post",
			dataType: "html",
			url: "${ctx}/member/get_update_member_base",
			async: true,
			data: {
				memberId:$("#member_id").val()
			},
			success : function(data) {
				$("#member_base_jsp").empty().html(data);
				$("#see_member_base").removeAttr("class").attr("class","btn  btn-sm btn-save pull-right").empty().text("保存");
			}
		});
	}

	//点击长者信息查看页面中的其他信息调用
	$("#edit_member_other").click(function(){
		var $text2 = $(this).text();
		if($text2 == "保存"){
			update_member_info(0);
		}
		if($text2 == "编辑"){
			get_update_member_info();	
		}
	});
	
	//获得长者修改页面中的其他信息页面
	function get_update_member_info(){
		$.ajax({
			type: "post",
			dataType: "html",
			url: "${ctx}/member/update_member_other_jsp",
			async: false,
			data: {
				memberId:$("#member_id").val()
			},
			success : function(data) {
				$("#member_other_jsp").empty().html(data);
				$("#edit_member_other").removeAttr("class").attr("class","btn  btn-sm btn-save pull-right").empty().text("保存");
			}
		});
	}

	//长者其他信息保存===flag为0时，会的查看页面，为1时不获得查看页面
	function update_member_info(flag){
		if(!$("#member_other_form").validationEngine("validate")){
			big_save_flag6 = 0;
			return false;
		} 
		if($("#huji_address").val().length >= 32){
			zhyAlert("详细地址长度应小于32");
			big_save_flag6 = 0;
			return false;
		}
		if($("#remark").val().length >= 256){
			zhyAlert("备注长度应小于256");
			big_save_flag6 = 0;
			return false;
		}
		
		var doctor=$("#doctor").val();
		var condition=$("#condition").val();
		var note=$("#note").val();
		if(doctor.trim()!=''||condition.trim()!=''||note.trim()!=''){
			if(doctor.length>20){
				big_save_flag6 = 0;
				return false;
			}
			if(condition.length>20){
				big_save_flag6 = 0;
				return false;
			}
			if(note.length>20){
				big_save_flag6 = 0;
				return false;
			}
		}
		var originalLiveCode='${liveCode}';
		var newLiveCode=$("#liveCode").val();
		if(originalLiveCode.trim()!=''){
			if(newLiveCode==''){
				zhyAlert("请填写住院号");
				big_save_flag6 = 0;
				return false;
			}
		}
		
		var origianlNurseLevel='${nurseLevel}';
		var newNurseLevel=$("#newNurseLevel").val();
		if(origianlNurseLevel!=''){
			if(newNurseLevel==''){
				zhyAlert("请选择护理等级");
				big_save_flag6 = 0;
				return false;
			}
		}
		hobbychecked();
		eat_taboochecked();
		take_carechecked();
		health_statechecked();
		body_statechecked();
		var other_value = new Array();
		if($("#other_hobby").val()!=""){
			other_value.push("hobby:"+$("#other_hobby").val());
		}
		
		if($("#other_eat_taboo").val()!=""){
			other_value.push("eat_taboo:"+$("#other_eat_taboo").val());
		}
		
		if($("#other_take_care").val()!=""){
			other_value.push("take_care:"+$("#other_take_care").val());
		}
		
		if($("#other_health_state").val()!=""){
			other_value.push("health_state:"+$("#other_health_state").val());
		}
		
		if($("#other_body_state").val()!=""){
			other_value.push("body_state:"+$("#other_body_state").val());
		}
		
		
		$.ajax({
			type: "post",
			dataType: "json",
			url: "${ctx}/member/save_member_info",
			async: false,
			data: {
				id: $("#infoId").val(),
				memberId: $("#member_id").val(),
				serverStationCode: $("#server_station_code").val(),
				kosekiProvince: $("#member_other_form").find(":input[name='province']").val(),
				kosekiCity: $("#member_other_form").find(":input[name='city']").val(),
				kosekiArea: $("#member_other_form").find(":input[name='area']").val(),
				kosekiAddress: $("#huji_address").val(),
				nation: $("#nation").attr("value"),
				bloodType: $("#blood_type").attr("value"),
				isRh: $("#is_rh").attr("value"),
				profession: $("#profession").val(),
				cultureDegree: $("#culture_degree").attr("value"),
				workUnit: $("#work_unit").val(),
				maritalStatus: $("#marital_status").attr("value"),
				pocketbook: $("#pocketbook").attr("value"),
				remark: $("#remark").val(),
				hobby: $("#hobby").val(),
				eatTaboo: $("#eat_taboo").val(),
				takeCare: $("#take_care").val(),
				healthState: $("#health_state").val(),
				bodyState: $("#body_state").val(),
				otherValue: other_value.join("@"),
				doctor:doctor,
				condition:condition,
				note:note,
				newNurseLevel:newNurseLevel,
				liveCode:newLiveCode
			},
			success : function(data) {
				if(data.resultCode === "SUCC" && data.data){
					big_save_flag6 = 1;
					if(flag == 0){
						$("#other_info").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
						$.ajax({
							type : "post",
							dataType: "html",
							url : "${ctx}/member/see_member_other_jsp",
							async: true,
							data:{
								memberId:$("#member_id").val(),
							},
							success : function(data) {
								$("#member_other_jsp").empty().html(data);
								$("#edit_member_other").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
							}
						});
					}
				}else{
					big_save_flag6 = 0;
					zhyAlert("保存失败");
				}
			}
		});
	}

	//长者详细信息中的兴趣爱好-------兴趣爱好中的其他选项另行取值
	function hobbychecked(){
		var hobbys = new Array();
		$("input[name=hobby]:checked").each(function(){
			var val = $(this).val();
			if(val != null && val != "" && val.length > 0){
				hobbys.push(val);
			}
		});
		
		if(hobbys.length > 0){
			$("#hobby").val(hobbys.join("_"));
		}else{
			$("#hobby").val("");
		}
	}
	
	//长者详细信息中的饮食禁忌-------饮食禁忌中的其他选项另行取值
	function eat_taboochecked(){
		var eatTaboos = new Array();
		$("input[name=eat_taboo]:checked").each(function(){
			var val = $(this).val();
			if(val != null && val != "" && val.length > 0){
				eatTaboos.push(val);
			}
		});
		
		if(eatTaboos.length > 0){
			$("#eat_taboo").val(eatTaboos.join("_"));
		}else{
			$("#eat_taboo").val("");
		}
	}
	
	//长者详细信息中的照看人-------照看人中的其他选项另行取值
	function take_carechecked(){
		var takeCares = new Array();
		$("input[name=take_care]:checked").each(function(){
			var val = $(this).val();
			if(val != null && val != "" && val.length > 0){
				takeCares.push(val);
			}
		});
		
		if(takeCares.length > 0){
			$("#take_care").val(takeCares.join("_"));
		}else{
			$("#take_care").val("");
		}
	}
	
	//长者详细信息中的健康状况-------健康状况中的其他选项另行取值
	function health_statechecked(){
		var healthStates = new Array();
		$("input[name=health_state]:checked").each(function(){
			var val = $(this).val();
			if(val != null && val != "" && val.length > 0){
				healthStates.push(val);
			}
		});
		
		if(healthStates.length > 0){
			$("#health_state").val(healthStates.join("_"));
		}else{
			$("#health_state").val("");
		}
	}
	
	//长者详细信息中的身体状况-------身体状况中的其他选项另行取值
	function body_statechecked(){
		var bodyStates = new Array();
		$("input[name=body_state]:checked").each(function(){
			var val = $(this).val();
			if(val != null && val  != "" && val.length > 0){
				bodyStates.push(val);
			}
		});
		
		if(bodyStates.length > 0){
			$("#body_state").val(bodyStates.join("_"));
		}else{
			$("#body_state").val("");
		}
	}
	
	function id_birthday(idName,birthdayName){
		if($("#idType .dropdown-text").attr("value") !== "0"){
			return;
		}
		
		var postionNumber = $("#"+idName).val();
		//18位身份證號
		if(postionNumber!=null&&postionNumber.trim().length==18){
			$("#"+birthdayName).val(postionNumber.substring(6,10)+"-"+postionNumber.substring(10,12)+"-"+postionNumber.substring(12,14)).blur();
		}
		//15位身份证号码
		if (postionNumber!=null&&postionNumber.length==15) {
			var birthdayValue = postionNumber.substring(6,8);
			if (parseInt(birthdayValue) < 10) {
				birthdayValue = '20' + birthdayValue;
			}else {
				birthdayValue = '19' + birthdayValue;
			}
			birthdayValue = birthdayValue + '-' + postionNumber.substring(8,10) + '-' + postionNumber.substring(10,12);
			$("#"+birthdayName).val(birthdayValue).blur(); 
		}
	}
	</script>
	
	
	<!-- 省市区联动 s -->
<script type="text/javascript" src="../../js/jquery.ganged.js"></script>
<script type="text/javascript" src="../../js/pro.js"></script><!--  省市区的json数据 -->
<!-- 省市区联动 e -->
<script type="text/javascript">
	/****
	***
	省市区联动 调用
	*/
	$('#jsAddress_0').ganged({'data': provinceList,'height':32,showAddress:true});
	var reside_area = '${memberBase.resideArea}';
	if(reside_area==null||reside_area==''||reside_area=='-1'){
		$('#jsAddress_0').empty();
	}
	
	
	
	
	
	/****
	***
	省市区联动 调用
	*/
	var jiazai_flag = '0';
	if(jiazai_flag != '1'){
	 	$('#jsAddress_1').ganged({'data': provinceList,'height':32});
	}
	<%--var koseki_area = '${kosekiArea}';--%>
	<%--if(koseki_area==null||koseki_area==''||koseki_area=='-1'){--%>
		<%--$('#jsAddress_1').empty();--%>
	<%--}--%>
	// $(".selectbox_show button").attr("disabled","disabled").css({"color":"#000000","cursor":"default"});
</script>	

				